home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / src / haeberli / tools / rgntest.c < prev    next >
C/C++ Source or Header  |  1994-08-01  |  2KB  |  74 lines

  1. /*
  2.  * Copyright 1991, 1992, 1993, 1994, Silicon Graphics, Inc.
  3.  * All Rights Reserved.
  4.  *
  5.  * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
  6.  * the contents of this file may not be disclosed to third parties, copied or
  7.  * duplicated in any form, in whole or in part, without the prior written
  8.  * permission of Silicon Graphics, Inc.
  9.  *
  10.  * RESTRICTED RIGHTS LEGEND:
  11.  * Use, duplication or disclosure by the Government is subject to restrictions
  12.  * as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
  13.  * and Computer Software clause at DFARS 252.227-7013, and/or in similar or
  14.  * successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
  15.  * rights reserved under the Copyright Laws of the United States.
  16.  */
  17. /*
  18.  *    rgntest -
  19.  *
  20.  *    An rgn example.  This program demonstrates an implementation 
  21.  *      of the functionality contained in ../libgutil/rgn.c.  This 
  22.  *      library provides support for management of regions.  A region 
  23.  *      can be thought of as an area described by a list of rectangles.
  24.  *            
  25.  *                Paul Haeberli - 1991        
  26.  */
  27. #include "gl.h"
  28. #include "device.h"
  29. #include "rct.h"
  30. #include "rgn.h"
  31.  
  32. main()
  33. {
  34.     rgn *r1, *r2, *r3;
  35.     int i;
  36.  
  37.     winopen("rgntest");
  38.     color(7);
  39.     clear();
  40.     color(0);
  41.  
  42.     r1 = rgnnew();
  43.     r2 = rgnnew();
  44.     r3 = rgnnew();
  45.  
  46.     rgnsetrect(r1,10,10,100,100);
  47.     rgnsetrect(r2,50,50,150,150);
  48.     color(1);
  49.     rgndraw(r1);
  50.     rgndraw(r2);
  51.     sleep(1);
  52.  
  53.     rgnunion(r1,r2,r3);
  54.     color(2);
  55.     rgnfill(r3);
  56.     sleep(1);
  57.  
  58.     for(i=0; i<5; i++) {
  59.     rgnshrink(r3,6,6);
  60.     color(3+i);
  61.     rgnfill(r3);
  62.     sginap(20);
  63.     }
  64.  
  65.     for(i=0; i<5; i++) {
  66.     rgnshadow(r3,6,6);
  67.     color(30+i);
  68.     rgnfill(r3);
  69.     sginap(20);
  70.     }
  71.  
  72.     sleep(1000);
  73. }
  74.